﻿using FluentExport.CSVExport;
using FluentExport.CSVExport.Interfaces;
using NSubstitute;
using NUnit.Framework;
using Should.Fluent;

namespace FluentExport.Tests.CSVExportTests
{
    [TestFixture]
    public class CSVSimpleSourceTests
    {
        [Test]
        public void MustGetValueCorrectly()
        {
            var sCsvExportHelper = Substitute.For<ICSVExportHelper>();
            sCsvExportHelper.FormatValue(Arg.Any<object>()).Returns(x => x[0]);

            var csvSimpleSource = new CSVSimpleSource(sCsvExportHelper) { PropertyName = "Name" };

            var dummyData = new DummyClassTest { Id = 223, Name = "Player 1" };

            var ret = csvSimpleSource.GetValue(dummyData);

            ret.Should().Not.Be.NullOrEmpty();
            ret.Should().Equal("Player 1");
        }
    }
}
